package com.chao.yyks.modular.score.controller;

import com.alibaba.fastjson.JSONObject;
import com.chao.common.util.log.Inter;
import com.chao.common.util.reaction.PageList;
import com.chao.yyks.modular.score.bean.EnScore;
import com.chao.yyks.modular.score.service.EnScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 成绩Controller
 * chao
 * 2024-09-13
 */
@RestController
@RequestMapping("/enScore")
public class EnScoreController {

	/**
	 * 成绩Service
	 */
	@Autowired
	private EnScoreService enScoreService;

	/**
	 * 提交答案
	 */
	@Inter("ESE_EDT_01")
	@RequestMapping(method = RequestMethod.POST, value = "updateEnScore")
	public void updateEnScore(@RequestBody EnScore enScore){
		enScoreService.updateEnScore(enScore.getScoreId());
	}

	/**
	 * 修改学生分数
	 */
	@Inter("ESE_EDT_02")
	@RequestMapping(method = RequestMethod.POST, value = "updateEnScoreStudent")
	public void updateEnScoreStudent(@RequestBody EnScore enScore){
		enScoreService.updateEnScoreStudent(enScore);
	}

	/**
	 * 删除学生考试
	 */
	@Inter("ESE_EDT_02")
	@RequestMapping(method = RequestMethod.POST, value = "deleteEnScoreStudent")
	public void deleteEnScoreStudent(@RequestBody EnScore enScore){
		enScoreService.deleteEnScoreStudent(enScore);
	}

	/**
	 * 查询成绩详情
	 */
	@Inter("ESE_SEL_01")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnScoreByScoreId")
	public EnScore selectEnScoreByScoreId(String scoreId){
		return enScoreService.selectEnScoreByScoreId(scoreId);
	}

	/**
	 * 查询成绩列表
	 */
	@Inter("ESE_SEL_02")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnScoreByList")
	public PageList<EnScore> selectEnScoreByList(@RequestParam Map<String,Object> map){
		return enScoreService.selectEnScoreByList(new JSONObject(map));
	}

	/**
	 * 分页查询成绩列表
	 */
	@Inter("ESE_SEL_03")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnScoreByPage")
	public PageList<EnScore> selectEnScoreByPage(@RequestParam Map<String,Object> map){
		return enScoreService.selectEnScoreByPage(new JSONObject(map));
	}

	/**
	 * 查询本周答题情况
	 */
	@Inter("ESE_SEL_04")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnScoreStudent")
	public JSONObject selectEnScoreStudent(@RequestParam Map<String,Object> map){
		return enScoreService.selectEnScoreStudent(new JSONObject(map));
	}

}